package com.xyazm.fulfill.event;

import com.xyazm.common.enums.OrderStatusChangeEnum;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * 获取 订单物流配送结果处理器
 * @author xuyou
 * @date 2023年02月13日 21:10
 */
@Component
public class WmsShipEventProcessorFactory {

    @Autowired
    private OrderOutStockEventProcessor orderOutStockEventProcessor;
    @Autowired
    private OrderDeliveredEventProcessor orderDeliveredEventProcessor;
    @Autowired
    private OrderSignedEventProcessor orderSignedEventProcessor;


    public OrderAfterFulfillEventProcessor getWmsShipEventProcessor(OrderStatusChangeEnum orderStatusChangeEnum) {
        if (OrderStatusChangeEnum.ORDER_OUT_STOCKED.equals(orderStatusChangeEnum)) {
            // 订单已出库
            return orderOutStockEventProcessor;
        }  else if (OrderStatusChangeEnum.ORDER_DELIVERED.equals(orderStatusChangeEnum)) {
             //订单已配送事件
            return orderDeliveredEventProcessor;
        } else if (OrderStatusChangeEnum.ORDER_SIGNED.equals(orderStatusChangeEnum)) {
            //订单已签收事件
            return orderSignedEventProcessor;
        }
        return orderOutStockEventProcessor;
    }


}
